// "This sample program is provided AS IS and may be used, executed, copied and modified without royalty payment by customer (a) for its own
// instruction and study, (b) in order to develop applications designed to run with an IBM WebSphere product, either for customer's own internal use
// or for redistribution by customer, as part of such an application, in customer's own products. "
//
// (C) COPYRIGHT International Business Machines Corp., 2005,2006
// All Rights Reserved * Licensed Materials - Property of IBM

package com;

import java.util.concurrent.ThreadFactory;

import com.ibm.websphere.asynchbeans.WorkManager;


/**
 * This is a ThreadFactory class which can be used to any of the Executors in the
 * JSR-166 (java.util.concurrent) library. It returns 'supported' daemon threads which are then
 * used with the Executors when they need a thread.  A WASThreadFactory instance should
 * not be shared amongst applications.
 * @see com.ibm.websphere.sample.concurrentadapter.WASThreadFactoryBase
 * @author Billy Newport and Chris D Johnson
 */
public class WASThreadFactory extends WASThreadFactoryBase implements ThreadFactory
{
	/**
	 * Create a proxy for the WorkManager instance so that in the future when
	 * we call a method on the proxy, it's called with the context of the caller
	 * of the constructor of this class. This is essential to give all daemon
	 * threads the same context. If we didn't do this then the Runnables would be
	 * executed using the context of the caller of newThread which would give
	 * an unpredictable context to each thread.
	 * @param wm the WorkManager to use for establishing our J2EE context.
	 */
    public WASThreadFactory(WorkManager wm)
    {
        super(wm);
    }
}
